// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObjectImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLAlterTableImportPartition.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../SQLName.h"
#include "../../../utils/listTran.h"

SQLAlterTableImportPartition::SQLAlterTableImportPartition()
{
  partitions = std::make_shared<std::list<SQLName_ptr>>();
}

SQLName_list_ptr SQLAlterTableImportPartition::getPartitions()
{
  return partitions;
}

void SQLAlterTableImportPartition::addPartition(SQLName_ptr partition)
{
  if (partition != nullptr)
  {
    partition->setParent(SharedObject(SQLAlterTableImportPartition));
  }
  this->partitions->push_back(partition);
}

// @Override
void SQLAlterTableImportPartition::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLAlterTableImportPartition)))
  {
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLName, SQLObject>(partitions);
    acceptChild(visitor, tmp1);
  }
  visitor->endVisit(SharedObject(SQLAlterTableImportPartition));
}

BOOL_ptr SQLAlterTableImportPartition::isTablespace()
{
  return tablespace;
}

void SQLAlterTableImportPartition::setTablespace(BOOL_ptr tablespace)
{
  this->tablespace = tablespace;
}
